package com.ssr.master;

import com.ssr.master.common.service.DataSourceTestService;
import com.ssr.master.modules.entity.SysUser;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

/**
 * @author ZhangPeng
 * @Describe //todo
 * @date
 * @updateBy
 * @other
 **/

@RunWith(SpringRunner.class)
@SpringBootTest
public class DynamicDataSourceTest {

    @Autowired
    private DataSourceTestService dataSourceTestService;

    @Test
    public void test(){
        // 数据源ONE
        SysUser user1 = dataSourceTestService.test1("1111");
        System.out.println("one+++++++++++++++++++++++++++++++++++++++++"+ToStringBuilder.reflectionToString(user1));

        // 数据源TWO
        SysUser user2 = dataSourceTestService.test2("1");
        System.out.println("two+++++++++++++++++++++++++++++++++++++++++"+ToStringBuilder.reflectionToString(user2));

//        // 数据源ONE
//        SysUser user3 = dataSourceTestService.test1(1L);
//        System.out.println(ToStringBuilder.reflectionToString(user3));
    }
}
